package hikari.managers;

import com.gooddies.wiring.annotations.Wire;
import com.gooddies.wiring.annotations.WiringComponent;
import hikari.gui.MainWindow;
import hikari.gui.assets.AssetArchiver;
import hikari.gui.assets.AssetsImporterSelector;
import hikari.utils.RenderingStopper;

/**
 * @author sad
 */
@WiringComponent(singleton = true, lazy = true)
public class AssetsManager {
    @Wire
    private MainWindow mainWindow;
    @Wire
    private RenderingStopper renderingStopper;

    private AssetsManager() {
    }

    public void saveAssetToArchive() {
        renderingStopper.stopRendering(new Runnable() {
            @Override
            public void run() {
                AssetArchiver archiverDialog = new AssetArchiver(mainWindow, true);
                archiverDialog.setVisible(true);
            }
        });
    }

    public void importAssetToArchive() {
        renderingStopper.stopRendering(new Runnable() {
            @Override
            public void run() {
                AssetsImporterSelector importDialog = new AssetsImporterSelector(mainWindow, true);
                importDialog.setVisible(true);
            }
        });
    }
}
